package com.zjapl.web.action;

import com.opensymphony.xwork2.ActionSupport;
import com.zjapl.web.action.vo.Employee;
import com.zjapl.web.service.EmployeeService;
import com.zjapl.web.service.impl.EmployeeServiceImpl;
import com.zjapl.web.util.aes.AES;

/**
 * @author linmeng E-mail:kevinlinm1989@gmail.com
 * @version 创建时间：2013-1-15 下午3:40:56
 * 类说明
 */
public class UpdateEmployeeAction extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String telephone1;
	private String telephone2;
	private String repassword;
	private Employee emp=new Employee();
	EmployeeService employeeServiceImpl=new EmployeeServiceImpl();
	
	public String getTelephone1() {
		return telephone1;
	}
	public void setTelephone1(String telephone1) {
		this.telephone1 = telephone1;
	}
	public String getTelephone2() {
		return telephone2;
	}
	public void setTelephone2(String telephone2) {
		this.telephone2 = telephone2;
	}
	public String getRepassword() {
		return repassword;
	}
	public void setRepassword(String repassword) {
		this.repassword = repassword;
	}
	public Employee getEmp() {
		return emp;
	}
	public void setEmp(Employee emp) {
		this.emp = emp;
	}
	
	public String execute() throws Exception {
		 String telephone=telephone1+"-"+telephone2; 
			 String passwordtmp="zjapl123456";
			 String Key="http://www.zjapl.com";
			 String password=AES.encrypttoStr(passwordtmp, Key);
			 emp.setPassword(password);
			 emp.setTelephone(telephone);
			 if(employeeServiceImpl.updateEmployee(emp)){
				 return SUCCESS;
			 }
		return ERROR;
	}

}
